<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/simple-queue-common.js"></script>
<script>
promise_test(t => {
  const ws = new WritableStream();
  const writer = ws.getWriter();
  const rejections = [];
  for (let i = 0; i < QUEUE_MAX_ARRAY_SIZE; ++i) {
    rejections.push(
        promise_rejects_js(t, Error, writer.write(i),
                           'write() promise should reject'));
  }
  return writer.abort(new Error()).then(() => Promise.all(rejections));
}, 'rejecting exactly 16K writes should work');
</script>
